# 类方法

class Phone:
    brand = '小米'
    price = 2988
    type = '米8'

    # 魔术方法 ：前后都有2个__名字__ (系统默认执行)
    def __init__(self):
        """
        初始化
        """
        print("init....")
        self.address_book = [] # 动态添加属性

    def call(self):  # self 是不断发生改变的
        """
        self 就是对象
        :return:
        """
        print("self----------->", self)
        print("正在打电话。。。。。。。")
        print("正在访问通讯录。。。。。。。")
        for person in self.address_book:  # 不能保证每个self种保证address_book;所以有阴影
            print(person.items())


xm = Phone()
print(xm.brand, xm.type, xm.price, sep=" ")
xm.address_book = [{"18799191912": "张三"}, {"18799191913": "李四"}]
print(xm)
print(xm.call())

hw = Phone()
hw.brand = '华为'
hw.type = 'mete 8'
hw.price = 3999
print(hw.brand, hw.type, hw.price, sep=" ")
print(hw)
print(hw.call())
print("*" * 30)

# 验证self

xm.note = '备注1：小米'
hw.note = '备注2：华为'

print(xm.note)
print(hw.note)
